/*******************************************************
> Copyright (C) 2024 ==IOT== All rights reserved.
> File Name: vem.cpp
> Author: IOT
> Website:www.slq.org
> Created Time: 2024年10月21日 星期一 15时32分18秒
***************************************************/

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

#if 0
class Person {
	string phone = "华为";
	
};
#endif

class Motor{
	float speed; // 速度
	
	public:
	void run()
	{
		cout << "电机以" << speed << "rad/s速度运行" << endl;
	}
	void stop()
	{
		cout << "电机停止" << endl;
	}
	void setSpeed(float _speed)
	{
		speed = _speed;
	}
	
};

class Drinks {
	
};

class VEM {
	Drinks slot[5]; // 存放饮料的槽
	Motor m; // 组合关系
	
	public:
	bool push_drinks(Drinks &drk);
	bool pop_drinks(void);
	bool Init();
};
bool VEM::Init()
{
	cout << "初始化马达" << endl;
	return true;
}
bool VEM::push_drinks(Drinks &drk)
{
	cout << "给一个高低电平，弹开货仓，添加商品\n";
	// 遍历槽内的饮料，如果有该饮料，对饮料的数量增加，如果没有该饮料，将其放入新的槽位
	slot[0].amount += drk.amount;
	
	return true;
}

bool VEM::pop_drinks()
{
	cout << "给一个高低电平，电机运转，推出商品\n";
	// 启动马达
	
	m.setSpeed(10);
	// 运转一段时间
	m.run();
	// 马达停止
	m.stop();
	
	return true;
}

int main(int argc,const char* argv[])
{
	VEM vending_electronic_machine;
	vending_electronic_machine.Init(); //初始化(马达...)
	int menu = 0;
	cout << "存入商品 ---- 1\n";
	cout << "取出商品 ---- 2\n";
	cout << "请选择：" << endl;
	cin >> menu;
	
	if (menu == 1)
		vending_electronic_machine.push_drinks();
	else if (menu == 2)
		vending_electronic_machine.pop_drinks();
	
	
    return 0;
}
